home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 025a / gsdb25.zip / DB_XPL13.PAS < prev    next >
Pascal/Delphi Source File  |  1990-12-18  |  2KB  |  68 lines

  1. program DB_Xpl13;
  2. uses
  3.    CRT,
  4.    DOS,
  5.    GS_KeyI,
  6.    GS_dBFld,
  7.    GS_dBase;
  8.  
  9. var
  10.    Health  : GS_dBFld_Objt;
  11.    DumyStr : string;
  12.  
  13. procedure ShowTheMemo;
  14. var
  15.    i,
  16.    ml   : integer;
  17.  
  18. begin
  19.    Health.MemoGet(Health.FieldGet('COMMENTS'));
  20.    ml := Health.MemoLines;
  21.    ClrScr;
  22.    if ml <> 0 then
  23.       for i := 1 to ml do
  24.          writeln(Health.MemoGetLine(i))
  25.       else write('[ EMPTY ]');
  26. end;
  27.  
  28.  
  29. procedure DisplayRecord;
  30. begin
  31.    Health.FieldDisplay('FOOD','Name of Food: ',1,1);
  32.    Health.FieldDisplay('QUANTITY','Quantity: ',1,2);
  33.    Health.FieldDisplay('UNITTYPE','Type of Unit: ',1,3);
  34.    Health.FieldDisplay('CALS','Calories: ',1,4);
  35.    Health.FieldDisplay('TOT_FAT_G','Total Fat: ',1,5);
  36.    Health.FieldDisplay('SAT_FAT_G','Saturated Fat: ',1,6);
  37.    gotoxy(1,7);
  38.    if Health.NumberGet('TOT_FAT_G') > 0.000 then
  39.       write('Percent of Saturated Fat to Total Fat is : ',
  40.          (Health.NumberGet('SAT_FAT_G')*100)/Health.NumberGet('TOT_FAT_G'):5:1)
  41.       else write('':79);
  42.    Health.FieldDisplay('CHOLES_MG','Cholesterol per Mg: ',1,8);
  43.    Health.FieldDisplay('COMMENTS','COMMENTS: ',1,9);
  44.    window(1,11,80,24);
  45.    ShowTheMemo;
  46.    window(1,1,80,25);
  47. end;
  48.  
  49.  
  50. begin
  51.    ClrScr;
  52.    GotoXY(1,25);
  53.    write('Press ESC to stop, any other key to continue');
  54.    Health.Init('HEALTH');
  55.    Health.Open;
  56.    Health.Index('FOODNAME');
  57.    Health.MemoWidth(75);
  58.    Health.GetRec(Top_Record);
  59.    while (not Health.File_EOF) and (not GS_KeyI_Esc) do
  60.    begin
  61.       DisplayRecord;
  62.       WaitForKey;
  63.       if GS_KeyI_Chr = Kbd_Esc then GS_KeyI_Esc := true;
  64.       Health.GetRec(Next_Record);
  65.    end;
  66.    Health.Close;
  67. end.
  68.